<template>
  <a-spin :spinning="confirmLoading">
    <j-form-container :disabled="formDisabled">
      <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="12">
            <a-form-model-item label="投保机构（印章）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="insureBranch">
              <a-input v-model="model.insureBranch" placeholder="请输入投保机构（印章）"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="数据日期（月末）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sjrq">
              <j-date placeholder="请选择数据日期（月末）" v-model="model.sjrq"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="填表日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fillingDate">
              <j-date placeholder="请选择填表日期" v-model="model.fillingDate"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="币种单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit">
              <a-input v-model="model.unit" placeholder="请输入币种单位"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="营业执照所载的机构全称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="busLicenseBranch">
              <a-input v-model="model.busLicenseBranch" placeholder="请输入营业执照所载的机构全称"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="金融机构代码证所载金融机构编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="financialInstCode">
              <a-input v-model="model.financialInstCode" placeholder="请输入金融机构代码证所载金融机构编码"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="营业执照所载的成立日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="busLicenseEstablishDate">
              <j-date placeholder="请选择营业执照所载的成立日期" v-model="model.busLicenseEstablishDate"  style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="注册资本" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="registeredCapital">
              <a-input-number v-model="model.registeredCapital" placeholder="请输入注册资本（注册资金）" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="住所" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="registeredAddress">
              <a-input v-model="model.registeredAddress" placeholder="请输入住所（注册地址）"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="经营管理总部地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="headOfficeAddress">
              <a-input v-model="model.headOfficeAddress" placeholder="请输入经营管理总部地址"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="法定代表人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="legalPerson">
              <a-input v-model="model.legalPerson" placeholder="请输入法定代表人"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境内存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnDepositCapital">
              <a-input-number v-model="model.jnDepositCapital" placeholder="请输入境内存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境内存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnDepositInterest">
              <a-input-number v-model="model.jnDepositInterest" placeholder="请输入境内存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境内存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnDepositAmount">
              <a-input-number v-model="model.jnDepositAmount" placeholder="请输入境内存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="个人存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnPerDepositCapital">
              <a-input-number v-model="model.jnPerDepositCapital" placeholder="请输入境内存款-个人存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="个人存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnPerDepositInterest">
              <a-input-number v-model="model.jnPerDepositInterest" placeholder="请输入境内存款-个人存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="个人存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnPerDepositAmount">
              <a-input-number v-model="model.jnPerDepositAmount" placeholder="请输入境内存款-个人存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitDepositCapital">
              <a-input-number v-model="model.jnUnitDepositCapital" placeholder="请输入境内存款-单位存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitDepositInterest">
              <a-input-number v-model="model.jnUnitDepositInterest" placeholder="请输入境内存款-单位存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitDepositAmount">
              <a-input-number v-model="model.jnUnitDepositAmount" placeholder="请输入境内存款-单位存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款-其中：住房公积金存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitHousingFundCapital">
              <a-input-number v-model="model.jnUnitHousingFundCapital" placeholder="请输入境内存款-单位存款-其中：住房公积金存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款-其中：住房公积金存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitHousingFundInterest">
              <a-input-number v-model="model.jnUnitHousingFundInterest" placeholder="请输入境内存款-单位存款-其中：住房公积金存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款-其中：住房公积金存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitHousingFundAmount">
              <a-input-number v-model="model.jnUnitHousingFundAmount" placeholder="请输入境内存款-单位存款-其中：住房公积金存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款-其中：社保基金存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitSocialFundCapital">
              <a-input-number v-model="model.jnUnitSocialFundCapital" placeholder="请输入境内存款-单位存款-其中：社保基金存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款-其中：社保基金存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitSocialFundInterest">
              <a-input-number v-model="model.jnUnitSocialFundInterest" placeholder="请输入境内存款-单位存款-其中：社保基金存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="单位存款-其中：社保基金存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnUnitSocialFundAmount">
              <a-input-number v-model="model.jnUnitSocialFundAmount" placeholder="请输入境内存款-单位存款-其中：社保基金存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisDepositCapital">
              <a-input-number v-model="model.jnFisDepositCapital" placeholder="请输入境内存款-财政性存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisDepositInterest">
              <a-input-number v-model="model.jnFisDepositInterest" placeholder="请输入境内存款-财政性存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisDepositAmount">
              <a-input-number v-model="model.jnFisDepositAmount" placeholder="请输入境内存款-财政性存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款-国库定期存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisFixedDepositCapital">
              <a-input-number v-model="model.jnFisFixedDepositCapital" placeholder="请输入境内存款-财政性存款-国库定期存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款-国库定期存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisFixedDepositInterest">
              <a-input-number v-model="model.jnFisFixedDepositInterest" placeholder="请输入境内存款-财政性存款-国库定期存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款-国库定期存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisFixedDepositAmount">
              <a-input-number v-model="model.jnFisFixedDepositAmount" placeholder="请输入境内存款-财政性存款-国库定期存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款-代理财政性存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisAgencyDepositCapital">
              <a-input-number v-model="model.jnFisAgencyDepositCapital" placeholder="请输入境内存款-财政性存款-代理财政性存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款-代理财政性存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisAgencyDepositInterest">
              <a-input-number v-model="model.jnFisAgencyDepositInterest" placeholder="请输入境内存款-财政性存款-代理财政性存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="财政性存款-代理财政性存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFisAgencyDepositAmount">
              <a-input-number v-model="model.jnFisAgencyDepositAmount" placeholder="请输入境内存款-财政性存款-代理财政性存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="非存款类金融机构存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFinOrgDepositCapital">
              <a-input-number v-model="model.jnFinOrgDepositCapital" placeholder="请输入境内存款-非存款类金融机构存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="非存款类金融机构存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFinOrgDepositInterest">
              <a-input-number v-model="model.jnFinOrgDepositInterest" placeholder="请输入境内存款-非存款类金融机构存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="非存款类金融机构存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnFinOrgDepositAmount">
              <a-input-number v-model="model.jnFinOrgDepositAmount" placeholder="请输入境内存款-非存款类金融机构存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwDepositCapital">
              <a-input-number v-model="model.jwDepositCapital" placeholder="请输入境外存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwDepositInterest">
              <a-input-number v-model="model.jwDepositInterest" placeholder="请输入境外存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwDepositAmount">
              <a-input-number v-model="model.jwDepositAmount" placeholder="请输入境外存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-个人存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwPerDepositCapital">
              <a-input-number v-model="model.jwPerDepositCapital" placeholder="请输入境外存款-个人存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-个人存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwPerDepositInterest">
              <a-input-number v-model="model.jwPerDepositInterest" placeholder="请输入境外存款-个人存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-个人存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwPerDepositAmount">
              <a-input-number v-model="model.jwPerDepositAmount" placeholder="请输入境外存款-个人存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-单位存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwUnitDepositCapital">
              <a-input-number v-model="model.jwUnitDepositCapital" placeholder="请输入境外存款-单位存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-单位存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwUnitDepositInterest">
              <a-input-number v-model="model.jwUnitDepositInterest" placeholder="请输入境外存款-单位存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-单位存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwUnitDepositAmount">
              <a-input-number v-model="model.jwUnitDepositAmount" placeholder="请输入境外存款-单位存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-境外同业存放本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwInterbankDepositsCapital">
              <a-input-number v-model="model.jwInterbankDepositsCapital" placeholder="请输入境外存款-境外同业存放本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-境外同业存放应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwInterbankDepositsInterest">
              <a-input-number v-model="model.jwInterbankDepositsInterest" placeholder="请输入境外存款-境外同业存放应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境外存款-境外同业存放合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jwInterbankDepositsAmount">
              <a-input-number v-model="model.jwInterbankDepositsAmount" placeholder="请输入境外存款-境外同业存放合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="高级管理人员在本机构存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="instDepositsCapital">
              <a-input-number v-model="model.instDepositsCapital" placeholder="请输入高级管理人员在本机构存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="高级管理人员在本机构存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="instDepositsInterest">
              <a-input-number v-model="model.instDepositsInterest" placeholder="请输入高级管理人员在本机构存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="高级管理人员在本机构存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="instDepositsAmount">
              <a-input-number v-model="model.instDepositsAmount" placeholder="请输入高级管理人员在本机构存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="不予保险的其他存款本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="otherDepositsCapital">
              <a-input-number v-model="model.otherDepositsCapital" placeholder="请输入不予保险的其他存款本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="不予保险的其他存款应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="otherDepositsInterest">
              <a-input-number v-model="model.otherDepositsInterest" placeholder="请输入不予保险的其他存款应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="不予保险的其他存款合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="otherDepositsAmount">
              <a-input-number v-model="model.otherDepositsAmount" placeholder="请输入不予保险的其他存款合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="被保险存款余额本金" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="depositBalanceCapital">
              <a-input-number v-model="model.depositBalanceCapital" placeholder="请输入被保险存款余额本金" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="被保险存款余额应付利息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="depositBalanceInterest">
              <a-input-number v-model="model.depositBalanceInterest" placeholder="请输入被保险存款余额应付利息" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="被保险存款余额合计" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="depositBalanceAmount">
              <a-input-number v-model="model.depositBalanceAmount" placeholder="请输入被保险存款余额合计" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="受保存款" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="insuredDeposit">
              <a-input-number v-model="model.insuredDeposit" placeholder="请输入受保存款（本金和应付利息合计口径）" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="被保险存款客户数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="custNum">
              <a-input-number v-model="model.custNum" placeholder="请输入被保险存款客户数" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="其中：最高偿付限额以内客户数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maxRepayLimitCustNum">
              <a-input-number v-model="model.maxRepayLimitCustNum" placeholder="请输入被保险存款客户数-其中：最高偿付限额以内客户数" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="各项存款（人民银行调统口径、本金）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="variousDeposits1">
              <a-input-number v-model="model.variousDeposits1" placeholder="请输入各项存款（人民银行调统口径、本金）" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="各项存款（银监部门统计口径、本金）" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="variousDeposits2">
              <a-input-number v-model="model.variousDeposits2" placeholder="请输入各项存款（银监部门统计口径、本金）" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="境内网点数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jnNetNum">
              <a-input-number v-model="model.jnNetNum" placeholder="请输入境内网点数（统计至最基层营业场所）" style="width: 100%" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="填表人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="preparer">
              <a-input v-model="model.preparer" placeholder="请输入填表人"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="复核人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reviewer">
              <a-input v-model="model.reviewer" placeholder="请输入复核人"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contacts">
              <a-input v-model="model.contacts" placeholder="请输入联系人"  ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="联系方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="telephone">
              <a-input v-model="model.telephone" placeholder="请输入联系方式"  ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
  </a-spin>
</template>

<script>

  import { httpAction, getAction } from '@/api/manage'
  import { validateDuplicateValue } from '@/utils/util'

  export default {
    name: 'SoInsuredDepositApplicationForm',
    components: {
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    data () {
      return {
        model:{
         },
        labelCol: {
          xs: { span: 24 },
          sm: { span: 9 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 12 },
        },
        confirmLoading: false,
        validatorRules: {
        },
        url: {
          add: "/soInsuredDepositApplication/soInsuredDepositApplication/add",
          edit: "/soInsuredDepositApplication/soInsuredDepositApplication/edit",
          queryById: "/soInsuredDepositApplication/soInsuredDepositApplication/queryById"
        }
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
       //备份model原始值
      this.modelDefault = JSON.parse(JSON.stringify(this.model));
    },
    methods: {
      add () {
        this.edit(this.modelDefault);
      },
      edit (record) {
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      submitForm () {
        const that = this;
        // 触发表单验证
        this.$refs.form.validate(valid => {
          if (valid) {
            that.confirmLoading = true;
            let httpurl = '';
            let method = '';
            if(!this.model.id){
              httpurl+=this.url.add;
              method = 'post';
            }else{
              httpurl+=this.url.edit;
               method = 'put';
            }
            httpAction(httpurl,this.model,method).then((res)=>{
              if(res.success){
                that.$message.success(res.message);
                that.$emit('ok');
              }else{
                that.$message.warning(res.message);
              }
            }).finally(() => {
              that.confirmLoading = false;
            })
          }
         
        })
      },
    }
  }
</script>